<?php
/**
 * Created by PhpStorm.
 * User: zhd
 * Date: 2017/12/14
 * Time: 0:17
 */

namespace controller;


use controller\base\Base;

class Complain extends Base
{
    /**
     * @param int $id id
     */
    public function index($id)
    {
        $this->assign('id', $id);
        $this->fetch();
    }

    /**
     * @param string $cause 原因
     * @param string $desc 描述
     * @param string $contact 联系方式
     * @param string $http_referer 投诉地址
     * @return  string
     */
    public function post($cause, $desc, $contact, $http_referer)
    {
        $complain = new \model\Complain();
        $complain->insert([
            'cause'        => $cause,
            'desc'         => $desc,
            'contact'      => $contact,
            'http_referer' => $http_referer
        ]);
        return json(['state' => true]);
    }
}